/*
 * @Description: 摄像头管理
 */
import request from '@/utils/request'
export default {
    /**
     * @description: 获取设施组及地块-只用在摄像头管理
     * @param {String} organizationtId
     * @return {Array}
     */
    getshexiangdikaui() {
        return request.post("/v3/facility/facility/queryFGByFtNo", {
            organizationList: [sessionStorage.organizationNo],
            facilityCategoryId: 1
        });
    },
    /**
     * @description: 获取生态沟渠列表
     * @param {String} organizationtId
     * @return {Array}
     */
    getshetaigouqulist() {
        return request.post("/v3/facility/facility/queryFGByFtNo", {
            organizationList: [sessionStorage.organizationNo],
            facilityCategoryId: 2
        });
    },
    /**
     * @description: 获取所有摄像头列表 *代表必填
     * @param {String/Number} page *
     * @param {String/Number} size *
     */
    getcameralist(params) {
        return request.post("/v3/iot/camera/queryByCondition", {
            ...params,
            organizationtNo: sessionStorage.organizationtNo,
            
        });
    },

    /**
     * @description: 获取表格列表 *代表必填
     * @param {String/Number} page *
     * @param {String/Number} size *
     */
    getlist(params) {
        return request.post("/v3/iot/cameraFacilityMapper/queryPageList", params);
    },
    /**
     * @description:模糊查询种养品种表格列表 *代表必填
     */
    // getqueryList(params) {
    //   return request.post("/plantVariety/queryByCondition", {
    //     auditFlag: 1,
    //     varietyNameLike: params
    //   });
    // },
    /**
     * @description: 添加摄像头
     * @param {Object}  *
     */
    addlist(params) {
        return request.post("/v3/iot/cameraFacilityMapper/add", {
            ...params
        });
    },
    /**
     * @description: 批量添加摄像头
     * @param {Object}  *
     */
    addslist(params) {
        return request.post("/v3/iot/cameraFacilityMapper/addBatch", {
            ...params
        });
    },
    /**
     * @description: 批量删除种养品种
     * @param {Object}  *
     */
    dellist(list) {
        return request.post("/v3/iot/cameraFacilityMapper/delList", {
            cameraFacilityMapperIdList: list
        });
    },
    /**
     * @description: 修改种养品种
     * @param {Object}  *
     */
    editlist(params) {
        return request.post("/plantVariety/edit", params);
    },
    /**
     * @description: 通过种养类别查种养品种
     * @param {Object}  *
     */
    querybycondition(params) {
        return request.post("/plantVariety/queryByCondition", {
            ...params
        });
    },
    /**
     * @description: 获取设备
     * @param {Object}  *设施组或设施id
     */
    getcontroshebeilist(params) {
        return request.post("v3/iot/dataItem/queryByCondition", {
            control: true,
            ...params
        });
        //  /sensorFacilityMapper/queryByCondition
    },
    /**
     * @description: 获取设备开关状态
     * @param {Object}  *设施组或设施id
     */
    getshebeikiaguanstau(params) {
        return request.get(`v3/iot/dataCollectNew/queryListById?dataItemIdList=${params.dataCollectNewId}`);
    },
    /**
     * @description: 控制设备开关
     * @param {Object}  *设施组或设施id
     */
    setshebeikiaguanstau(params) {
        return request.post("/v3/iot/iotPlatform/rtuControl/remoteControl", {
            ...params
        });
    },
    /**
     * @description: 将配置策略添加至小方的数据库
     */
    addconfigconditiondata(params) {
        return request.post("v3/iot/deviceStrategy/add", {
            ...params
        });
    },
    /**
     * @description: 删除已有配置策略
     */
    delconfigconditiondata(params) {
        return request.post("v3/iot/deviceStrategy/delList", {
            vrtualDeviceStrategyIdList: params
        });
    },
    /**
     * @description: 修改已有配置策略
     */
    editconfigconditiondata(params) {
        return request.post("v3/iot/deviceStrategy/edit", {
            vrtualDeviceStrategyId: params.vrtualDeviceStrategyId,
            status: params.status
        });
    },
    /**
     * @description: 配置优先级
     */
    editconfigpriority(params) {
        return request.post("v3/iot/deviceStrategy/editBatch", params);
    },
    /**
     * @description: 获取验证码
     */
    getcodeimg() {
        return request.get("v3/organization/code/getCode");
    },
    /**
     * @description: 调用物联网相关接口--主要用于执行策略（启用策略）***
     */
    editrtualdevice(params) {
        return request.post("v3/iot/iotPlatform/rtuRunStrategy/add", params);
    },
    /**
     * @description: 修改已有配置策略2
     */
    neweditconfigconditiondata(params) {
        return request.post("v3/iot/device/edit", params);
    },
    /**
     * @description: 条件查下小方的配置策略数据库
     */
    queryhassaveconfig(params) {
        return request.post("v3/iot/deviceStrategy/queryByCondition", {
            ...params
        });
    },
    /**
     * @description: 获取数据项
     * @return {Object}
     */
    getdataitem(params) {
        return request.post("v3/iot/dataItem/queryByCondition", {
            organizationNo: sessionStorage.organizationNo,
            control: true
        });
    },
    /**
     * @description: 获取数据项2号
     * @return {Object}
     */
    getdataitemtwo(params) {
        return request.post(`v3/iot/deviceDataItemMapper/queryByCondition`, { deviceNo: params });
    },
    /**
     * @description: 根据设施或设施组id获取虚拟设备
     * @return {Object}
     */
    getvrtuallist(params) {
        // let parzh = {
        //   distributionId: 0,
        //   // distributionType: ""
        // };
        // if (params.facilityNo) {
        //   // parzh.distributionType = "地块";
        //   parzh.facilityNo = params.facilityNo;
        // } else {
        //   // console.log(params);
        //   console.log("未选中任何设施或设施组");
        // }
        return request.post("v3/iot/deviceFacilityMapper/queryByCondition", params);
    }
};
